﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;

namespace FubiManger.UI
{
    partial class LogisticsForm : Smobiler.Core.Controls.MobileForm
    {
        public LogisticsForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 订单号
        /// </summary>
        public string ordsn { get; set; }
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }
        /// <summary>
        /// 选择物流
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void panexpress_Press(object sender, EventArgs e)
        {
            popexpress.ShowDialog();
        }

        private void popexpress_Selected(object sender, EventArgs e)
        {
            txtname.Text = popexpress.Selection.Text;
        }

        private void LogisticsForm_Load(object sender, EventArgs e)
        {
            lblordsn.Text = ordsn;//订单号
        }

        private void btnlog_Press(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtname.Text))
            {
                MessageBox.Show("请选择物流公司");
            }
            else if (string.IsNullOrEmpty(txtcode.Text))
            {
                MessageBox.Show("请填写运单号");
            }
            else
            {
                if (orderDal.Logistics(ordsn, txtcode.Text, txtname.Text) > 0)
                {
                    Toast("物流发货成功");
                    this.Close();
                }
            }
        }
    }
}